package br.urca.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Lucas
 */
@Entity
@Table(name = "BI_RESERVAS")
public class BiReservas implements Serializable {
   
	private static final long serialVersionUID = 1L;
    
	@Id
    @Basic(optional = false)
    @Column(name = "COD_RESERVA")
    private String codReserva;
    
	@Column(name = "MATRICULA_ALUNO")
    private String matriculaAluno;
    
	@Column(name = "MATRICULA_FUNCIONARIO")
    private String matriculaFuncionario;
    
    @Column(name = "DATA")
    @Temporal(TemporalType.TIMESTAMP)
    private Date data;

    @OneToMany(cascade = CascadeType.ALL, mappedBy = "biReservas", fetch = FetchType.EAGER)
    private List<BiItensReserva> biItensReservaList;

    public BiReservas() {
    }

    public BiReservas(String codReserva) {
        this.codReserva = codReserva;
    }

    public BiReservas(String codReserva, Date data) {
        this.codReserva = codReserva;
        this.data = data;
    }

    public String getCodReserva() {
        return codReserva;
    }

    public void setCodReserva(String codReserva) {
        this.codReserva = codReserva;
    }

    public String getMatriculaAluno() {
        return matriculaAluno;
    }

    public void setMatriculaAluno(String matriculaAluno) {
        this.matriculaAluno = matriculaAluno;
    }

    public String getMatriculaFuncionario() {
        return matriculaFuncionario;
    }

    public void setMatriculaFuncionario(String matriculaFuncionario) {
        this.matriculaFuncionario = matriculaFuncionario;
    }

    public Date getData() {
        return data;
    }

    public void setData(Date data) {
        this.data = data;
    }

    public List<BiItensReserva> getBiItensReservaList() {
        return biItensReservaList;
    }

    public void setBiItensReservaList(List<BiItensReserva> biItensReservaList) {
        this.biItensReservaList = biItensReservaList;
    }

    @Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((codReserva == null) ? 0 : codReserva.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		BiReservas other = (BiReservas) obj;
		if (codReserva == null) {
			if (other.codReserva != null)
				return false;
		} else if (!codReserva.equals(other.codReserva))
			return false;
		return true;
	}

	@Override
    public String toString() {
        return "model.BiReservas[ codReserva=" + codReserva + " ]";
    }
    
}
